# coding=utf-8
"""
    @project: 15python_spider
    @Author：frank
    @file： 01_csv_example.py
    @date：2023/12/26 20:13
"""
import csv

# windows中使用csv模块默认添加一个空行，使用newline=''可以解决
with open('test.csv', 'w', encoding='utf-8', newline='') as f:
    # 初始化写入对象
    writer = csv.writer(f)
    writer.writerow(['李永超', 29])
    writer.writerow(['林伟萍', 29])
with open('test.csv', 'a', encoding='utf-8', newline='') as f:
    writer = csv.writer(f)
    writer.writerow([('身体健康', 2024), ('大吉大利', 2024), ('暴富', 2024)])
